package com.qf.android.huihui.presenter;

import com.qf.android.huihui.bean.DetailListItemBean;
import com.qf.android.huihui.model.DetailListItemModel;
import com.qf.android.huihui.model.impl.IDetailListItem;
import com.qf.android.huihui.presenter.impl.BasePresenter;
import com.qf.android.huihui.view.fragment.impl.IDetailListItemView;

import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by lx on 2017/1/11.
 */

public class DetailListItemPresenter implements BasePresenter {
    private IDetailListItem model;
    private IDetailListItemView view;

    public DetailListItemPresenter( IDetailListItemView view) {
        this.model = new DetailListItemModel();
        this.view = view;
    }


    public void getData(int id) {
        final Observable<DetailListItemBean> detailList =model.loadInfo(id);
        detailList.subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<DetailListItemBean>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(DetailListItemBean detailListItemBean) {
                        view.setDate(detailListItemBean);
                    }


                });
    }

    @Override
    public void getData() {

    }

    @Override
    public void getData(Object page, Object type, boolean isUpfresh, boolean isDownfresh, Object adapter, Object recyclerview) {

    }


}
